import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  UseGuards,
} from '@nestjs/common';
import { RoleService } from './role.service';
import { CreateRoleDto } from './dto/create-role.dto';
import { UpdateRoleDto } from './dto/update-role.dto';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { AuthGuard } from '@nestjs/passport';
import { Roles } from '../../common/decorator/roles.decorator';
import { Role } from '../../common/types/role';
import { RolesGuard } from '../../common/guards/roles.guard';

@Controller('role')
@ApiTags('[ADMIN]角色管理')
@UseGuards(AuthGuard('jwt'))
@ApiBearerAuth()
export class RoleController {
  constructor(private readonly roleService: RoleService) {}
  @Get()
  @Roles(Role.ADMIN)
  @UseGuards(RolesGuard)
  @ApiOperation({ summary: '获取所有角色' })
  findAll() {
    return this.roleService.findAll();
  }
}
